package com.example.javapoint.threads.join;

/**
 * 调用join() 方法抛出异常的情况
 */
class ABC extends Thread{
    Thread thread;
    @Override
    public void run() {
        thread.interrupt();// 线程中断
    }
}

public class ThreadInterruptedException {
    public static void main(String[] args) {
        ABC th = new ABC();
        th.thread = Thread.currentThread(); // 当前线程赋值给run() 方法中的线程
        th.start();
        try {
            th.join();
        } catch (InterruptedException e) {
            System.out.println("The exception has been caught. " + e);
            e.printStackTrace();
        }
    }
}
